package com.cy;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableDiscoveryClient
public class ScaGatewayApplication implements CommandLineRunner {

    @Value("${spring.cloud.gateway.discovery.locator.enabled}")
    private String enable;

    public static void main(String[] args) {
        SpringApplication.run(ScaGatewayApplication.class, args);
    }

    /**
     * SpringBoot工程中，加入希望在服务启动后，获取一些信息，并将其输出
     * 可以将启动类实现CommandLineRunner接口，并重写run方法，此方法会在服务启动以后自动执行
     * @param args
     * @throws Exception
     */
    @Override
    public void run(String... args) throws Exception {
        System.out.println("enable=" + enable);
    }
}
